package com.eric.springboot.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.eric.springboot.entity.Role;
import com.eric.springboot.entity.UserRole;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;


/**
 * @author Eric
 * @date 2021.2.3
 */
@Repository
public interface UserRoleMapper extends BaseMapper<UserRole> {

    int deleteByPrimaryKey(Long id);

    int insert(UserRole record);

    int insertSelective(UserRole record);

    UserRole selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(UserRole record);

    int updateByPrimaryKey(UserRole record);

    /**
     * 查询用户拥有的角色
     * @param userId 用户id
     * @return
     */
    List<Role> selectRolesByUserId(@Param("userId") Long userId);
}